import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';

part '{{classFilename}}.g.dart';

abstract class {{classname}} implements Built<{{classname}}, {{classname}}Builder> {

{{#vars}}
    {{#description}}/* {{{description}}} */{{/description}}
    {{#isNullable}}
        @nullable
    {{/isNullable}}
    @BuiltValueField(wireName: r'{{baseName}}')
    {{#isEnum}}{{classname}}{{{nameInCamelCase}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}} get {{name}};
    {{#allowableValues}}
        {{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}
    {{/allowableValues}}
{{/vars}}

    // Boilerplate code needed to wire-up generated code
    {{classname}}._();

    factory {{classname}}([updates({{classname}}Builder b)]) = _${{classname}};
    static Serializer<{{classname}}> get serializer => _${{classVarName}}Serializer;
}
{{!
    Generate an enum for any variables that are declared as inline enums
    isEnum is only true for inline variables that are enums.
    If an enum is declared as a definition, isEnum is false and the enum is generated from the
    enum.mustache template.
}}
{{#vars}}
    {{#isEnum}}

{{>enum_inline}}

    {{/isEnum}}
{{/vars}}